Skip to main content

TridentSwapAdapter

The TridentSwapAdapter is an abstract contract that is inherited to provide functions required by the SushiXSwap contract to perform all Trident based swaps.

The full contract can be found here here.

Read-Only Functions

State-Changing Functions

_exactInput

function _exactInput(
ExactInputParams memory params
) internal returns (uint256 amountOut);

Performs a swap of tokenIn for another token (determined by the pool path) via one or more trusted pools.

  • msg.sender should have already given the contract an allowance of at least amountIn on tokenIn.
  • amountOutMinimum can be used for slippage protection.

Parameters

NameTypeDescription
paramsExactInputParamsa struct containing the parameters for the swap

The ExactInputParams struct contains:

NameTypeDescription
tokenInaddressaddress for the input token
amountInuint256amount of tokenIn to swap
amountOutMinimumuint256minimum amount of output tokens that must be received for the transaction not to revert
pathstructa struct containing information about the pools to use for the swap. Each element of the array represents one swap in the path

Returns

NameTypeDescription
amountOutuint256amount of output tokens received

Reverts

This function reverts if the amount of tokens received is less than amountOutMinimum.

Modifiers

This function doesn't use any modifiers.

Functions called

This function calls the swap function of the pools in the path and the transferTokens and deposit functions of the current contract.


_complexPath

function _complexPath(
ComplexPathParams memory params
) internal;

Performs a complex swap involving multiple input tokens, multiple output tokens, and multiple paths.

  • The function requires that the user has already given the contract an allowance of at least the input amounts for each token.

Parameters

NameTypeDescription
paramsComplexPathParamsa struct containing the parameters for the swap

The ComplexPathParams struct contains:

NameTypeDescription
initialPathstruct arrayan array of structs containing information about the initial tokens to be swapped and the pools to use
percentagePathstruct arrayan array of structs containing information about the middle swaps
outputstruct arrayan array of structs containing information about the output tokens

Returns

This function doesn't return any values.

Reverts

This function reverts if the amount of tokens received for any output token is less than its minAmount.

Modifiers

This function doesn't use any modifiers.

Functions called

This function calls the swap function of the pools in the path, and the transfer, balanceOf, and withdraw functions of the BentoBox contract.